package com.cskaoyan.controller;

import com.cskaoyan.bean.MarketAd;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.vo.wxhomeindexvo.WxHomeIndexChannelVo;
import com.cskaoyan.bean.vo.wxhomeindexvo.WxHomeIndexbrandListVo;
import com.cskaoyan.bean.vo.wxhomeindexvo.*;
import com.cskaoyan.service.WxHomeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description:TODO
 * @author: landz
 * @create: 2023-01-01 23:42
 * @version:
 */
@RestController
@RequestMapping("wx")
public class WxHomeController {

    @Resource
    WxHomeService wxHomeService;


    /**
     * wx/home/index接口的实现，小程序界面，首页板块信息回功能实现
     * 
     * @return com.cskaoyan.bean.common.BaseRespVo 
     * @author landz
     * @create 2023/1/2 0:09
     **/
    @GetMapping("home/index")
    public BaseRespVo homeIndex(){
        //存放响应的主要信息，所有的List
        DataBeanVo dataBeanVos = new DataBeanVo();
        //获取所有的banner
        List<MarketAd> marketAds = wxHomeService.getBanner();
        //获取所有的brandList
        List<WxHomeIndexbrandListVo> wxHomeIndexbrandListVos = wxHomeService.getBrandList();
        //获取所有的channel
        List<WxHomeIndexChannelVo> wxHomeIndexChannelVo =  wxHomeService.getChannel();
        //获取所有的couponList
        List<CouponListVo> couponListVos = wxHomeService.getCouponList();
        //获取所有的floorGoodsList
        List<FloorGoodsListVo> floorGoodsListVos = wxHomeService.getFloorGoodsList();
        //获取所有的hotGoodsList
        List<HotGoodsListVo> hotGoodsListVos = wxHomeService.getHotGoodsList();
        //获取所有的newGoodsList
        List<NewGoodsListVo> newGoodsListVos = wxHomeService.getNewGoodsList();
        //获取所有的topicList
        List<TopicListVo> topicListVos = wxHomeService.getTopicList();
        //回去所有的channel
        //        List<ChannelVo> channelVoList = wxHomeService.getChannel();
        dataBeanVos.setBanner(marketAds);
        dataBeanVos.setChannel(wxHomeIndexChannelVo);
        dataBeanVos.setBrandList(wxHomeIndexbrandListVos);
        dataBeanVos.setCouponList(couponListVos);
        dataBeanVos.setFloorGoodsList(floorGoodsListVos);
        dataBeanVos.setHotGoodsList(hotGoodsListVos);
        dataBeanVos.setNewGoodsList(newGoodsListVos);
        dataBeanVos.setTopicList(topicListVos);

        return BaseRespVo.ok(dataBeanVos);
    }
}
